﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.Security;

namespace FJASPX.UI.Extention
{
    public class UserLogin : IHttpHandler
    {
        public bool IsReusable
        {
            get { return true; }
        }

        public void ProcessRequest(HttpContext context)
        {
            HttpRequest request = context.Request;
            HttpResponse respose = context.Response;
            if (context.User.Identity.IsAuthenticated)
            {
                respose.Write(context.User.Identity.Name);
                respose.End();
            }
            respose.Write("");
            respose.End();
        }
    }   public class UserLogin1 : IHttpHandler
    {
        public bool IsReusable
        {
            get { return true; }
        }

        public void ProcessRequest(HttpContext context)
        {
            HttpRequest request = context.Request;
            HttpResponse response = context.Response;
            string username = request.QueryString["UserName"].ToString();
            string password = request.QueryString["PassWord"].ToString();
            if (Membership.ValidateUser(username, password))
            {
                FormsAuthentication.SetAuthCookie(username, false);
                response.Write("1");
                response.End();
            }
            response.Write("用户名或密码错误！");
            response.End();
        }  
    }
}
